#include "Thread.hpp"
#include <unistd.h>
#include <vector>
std::string GetThreadname()
{
    static int num = 1;
    char name[64];
    snprintf(name, sizeof(name), "Thread-%d", num);
    num ++;
    return (const char*)name;
}
void Print(int num)
{
    while(num --)
    {
        std::cout << "Helloworld-" << num << std::endl;
        sleep(1);
    }
}
int main()
{

    Thread<int> t(GetThreadname(), Print, 5);

    t.Start();
    
    t.Join();
    const int num = 5;
    std::vector<Thread<int>> threads;
    for(int i = 0;i < num;i ++)
    {
        threads.push_back(Thread<int>(GetThreadname(), Print, 5));
    }

    for(int i = 0;i < 5;i ++)
    {
        threads[i].Start();
    }

    for(int i = 0;i < 5;i ++)
    {
        threads[i].Join();
    }
    return 0;
}